#include "lockscreen.h"
#include "ui_lockscreen.h"
#include "mainwindow.h"
#include "inquiresql.h"
#include <QMessageBox>
#include <QCloseEvent>

LockScreen::LockScreen(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::LockScreen)
{
    ui->setupUi(this);

    //设置自定义的鼠标指针图案
    QCursor *myCursor= new QCursor(QPixmap(":/Mouse/Image/mouse/mouse.png"),15,10);
    setCursor(*myCursor);

}

LockScreen::~LockScreen()
{
    delete ui;
}

void LockScreen::closeEvent(QCloseEvent *event)
{
    event->ignore();
}

void LockScreen::on_pushButtonUnlockScreen_clicked()
{
    QString paswd = m_sql->inquire_staff_password(MainWindow::staffID);
    if (paswd == ui->lineEditPassword->text())
    {
        this->hide();
    }
    else
    {
        QMessageBox::information(this, tr("(☆_☆)温馨提示 ..."),
                                 tr("\n您输入的(用户密码)错误,"
                                     "\n请您重新输入正确的(用户密码)") );
        ui->lineEditPassword->setFocus();
        ui->lineEditPassword->setText(NULL);
    }
}
